A database management system (DBMS) supports transactions to access data items stored in a database. Before actually accessing the items, a transaction acquires locks on the data items that it wishes to access. Typically, a read only or read/write access may be requested on the data item. Generally, this is termed as shared and exclusive access in the literature. Thus locks are requested in a pair <resource, lock mode>, where the lock mode indicates the kind of access the transaction needs on the resource. Typically these modes are denoted as S or X lock modes. If a transaction owns an X lock on a given resource, no other transaction can own any lock in any mode on that resource. This is generally known as a lock conflict. Thus X conflicts with all other modes, and S conflicts with X mode. However, S is compatible with another S mode lock on the resource.
In the interest of performance, often it is useful to define structure on data. For example, data in a typical database can be classified into tables and records in a table. An X lock on a table can be considered as an X lock on all rows in the table. This technique is termed as hierarchical locking. Only using X and S locks are inadequate in supporting hierarchical locking, and therefore a typical DBMS supports many more lock modes, to enhance transaction concurrency.
For example, most DBMSs use IS, S, IX, X, SIX and U lock modes for controlling concurrent accesses to data items. The IS mode refers to intention shared (obtained on the table), intention to take S locks on underlying rows. The IX mode refers to intention exclusive (obtained on the table), intention to take X locks on underlying rows. The S mode refers to shared, if obtained on the table, implies an S lock on all underlying rows. The SIX mode refers to shared intention exclusive, a combination of S and IX, obtained on the table. The U mode refers to update lock (can be obtained on the table), it means that a X lock may requested on the data item in the future.
Typically a database consists of isolated transactions. The degree of isolation may vary among transactions. The American National Standards Institute (ANSI) has defined various degrees of isolation from strict SERIALIZABLE to DIRTY READ. Existing lock modes may be sufficient to synchronize data access among serializable transactions. But, the lock modes described above are too restrictive in terms of avoidable conflicts as per the semantics of non-serializable transactions.